import { DELETE, GET, POST, PUT } from '@/http';

export const dynamicListSelect = (params) => {
  return GET({
    url: '/admin/dynamic/dynamicListSelect',
    params
  });
};

export const getArticleType = () => {
  return GET({
    url: '/article/getArticleType'
  });
};

// http://localhost:8166

export const addArticle = (data = {
  'content': '',
  'title': '',
  'type': 0,
  'userName': ''
}) => {
  return POST({
    url: '/article/addArticle',
    data: data
  });
};

export const updateArticle = (data = {
  id: 0,
  'content': '',
  'title': '',
  'type': 0,
  'userName': ''
}) => {
  return PUT({
    url: '/article/updateArticle',
    data: data
  });
};

export const getArticleDetail = (id) => {
  return GET({
    url: '/article/getArticleDetailsById',
    params: {
      id
    }
  });
};

// http://localhost:8166/article/deleteArticle

export const deleteDynamic = (id) => {
  return DELETE({
    url: '/admin/dynamic/deleteDynamic',
    params: {
      id: id[0]
    }
  });
};
